package com.info.zhiduoduo.alipay.constant;

import com.info.zhiduoduo.common.constants.EnumFindHelper;

/**
 * 支付宝订单业务类型
 */
public enum AlipayOrderEnum {

	UNKOWN(0, "", ""),
	/** 委托人给自己充值 */
	PRINCIPAL_RECHARGE(1, "FUND_ACCOUNT_BOOK", "COMANAGER_SATF_DEPOSIT"),
	/** 委托人转账给受托人 */
	PRINCIPAL_TRANSFER(2, "SINGLE_TRANSFER_NO_PWD", "ENTRUST_ALLOCATION"),
	/** 受托人代付到户/卡 */
	ENTRUSTEE_PAY(3, "SINGLE_TRANSFER_NO_PWD", "ENTRUST_TRANSFER"),
	/** 受托人退款给委托人 */
	ENTRUSTEE_REFUND(4, "SINGLE_TRANSFER_NO_PWD", "ENTRUST_ALLOCATION"),
	/** 委托人转账给企业公户 */
	PRINCIPAL_TRANSFER_PUBLIC_BANK(5, "SINGLE_TRANSFER_NO_PWD", "ENTRUST_TRANSFER"),
	/** 委托人代付到户/卡 */
	PRINCIPAL_PAY(6, "SINGLE_TRANSFER_NO_PWD", "ENTRUST_TRANSFER"),
	;

	public int type;
	public String productCode;
	public String bizScene;

	AlipayOrderEnum(int type, String productCode, String bizScene) {
		this.type = type;
		this.productCode = productCode;
		this.bizScene = bizScene;
	}

	//####################################### 方便查找枚举值的方法 ###################################//

	static final EnumFindHelper<AlipayOrderEnum, Integer> TypeHelper = new EnumFindHelper<>(AlipayOrderEnum.class, e -> e.type);

	public static AlipayOrderEnum findById(int id) {
		return TypeHelper.find(id, UNKOWN);
	}

}
